package com.git.code.service.user.service;

import com.git.code.service.common.commonenum.CommonTips;
import com.git.code.service.user.entity.Member;
import com.git.code.service.common.exception.AdException;
import com.git.code.service.user.repository.MemberRepository;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MemberService {
    @Resource
    private MemberRepository memberRepository;

    public Member checkByMobile(String mobile) throws AdException {
        List<Member> members = memberRepository.findByMobile(mobile);
        if(members.size() == 0){
            throw new AdException(CommonTips.NoEntity.getDes());
        }
        //用户已过期
        return members.get(0);
    }
}
